﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Tauren.Business.Infrastructure.Common;
using Tauren.Business.Service.System_Log;

namespace Tauren.Business.Core.Controllers
{
    /// <summary>
    /// 日志系统
    /// </summary>
    [Route("api/syslog"), ApiVersion("1.0")]
    [ApiController]
    public class SystemLogController : ControllerBase
    {
        public SystemLogController(ISystemLogService service)
        {
            this.service = service;
        }
        private ISystemLogService service { get; set; }
        /// <summary>
        /// 分页获取 账号信息列表
        /// </summary>
        /// <param name="queryModel"></param>
        /// <returns></returns>
        [HttpPost, Route("v{version:apiVersion}/pages")]
        public IActionResult Pages([FromBody] Entity.Global.QueryModel queryModel) => service.Pages(queryModel).ToJsonResult(true);
        /// <summary>
        /// 根据主键获取数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpPost, Route("v{version:apiVersion}/get/{id}")]
        public IActionResult Get([FromRoute] long id) => service.GetByID(id: id).ToJsonResult();
        /// <summary>
        /// 获取Model数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpPost, Route("v{version:apiVersion}/config")]
        public IActionResult Config() => service.Config().ToJsonResult(true);
    }

}
